$ document
	.ready ()->
		$ '.quikCheck'
			.bind 'click',ill
		$ 'button#reset'
			.bind 'click',()->
				$ 'input[name=key]'
					.val("")
		$ 'button#sure'
			.bind 'click',nextIll

ill = ()->
	$ '.log'
		.html '请输入请假日期'
	$ '.mask'
		.css 'display','block'

$ document
	.keydown (event)->
		if event.keyCode is 27
			closeCheck()

closeCheck = ()->
	$ '.mask'
		.css 'display','none'
	
nextIll = ->
	month = ($ "input[name=month]").val()/1
	day = ($ "input[name=day]").val()/1
	if month>12 or month<1 or day>31 or day<1
		$ '.log'
			.html 'error input'
	else
		$.post "/student/course/#{cid}/ill",{m:month,d:day},(data)->
			if data.head is "ok"
				$ '.log'
					.html 'success'
			else
				$ '.log'
					.html data.info
				
